import { FontUtil } from "font/FontUtil";
import { FontName } from "font/FontName";
type int = number;
//class GTextFormat

export class GTextFormat/* flash.text.TextFormat */ {
  [key:string]:any
  constructor(
    arg1: string | null = null,
    arg2: any | null = null,
    arg3: any | null = null,
    arg4: any | null = null,
    arg5: any | null = null,
    arg6: any | null = null,
    arg7: any | null = null,
    arg8: any | null = null,
    arg9: any | null = null,
    arg10: any | null = null,
    arg11: any | null = null,
    arg12: any | null = null,
    arg13: any | null = null
  ) {
    if (arg1) {
      this.font = arg1;
    } else {
      this.font = FontUtil.defaultFont.fontName;
    }
    if (arg2) {
      this.size = arg2;
    } else {
      this.size = 12;
    }
    return;
  }

  public set /* override */ font(arg1: string) {
    if (arg1) {
      super.font = arg1;
    } else {
      super.font = FontUtil.defaultFont.fontName;
    }
    this.updateSize();
    return;
  }

  public set /* override */ size(arg1: Object) {
    if (arg1) {
      this.outSize = int(arg1);
    } else {
      this.outSize = 12;
    }
    this.updateSize();
    return;
  }

  public get /* override */ size(): Object {
    return this.outSize;
  }

  protected updateSize(): void {
    var loc1 = FontName.getFontByName(this.font);
    if (loc1) {
      this.size = loc1.getFontSize(this.outSize);
    } else {
      this.size = this.outSize;
    }
    return;
  }

  public clone(): GTextFormat {
    var loc1 = new GTextFormat();
    loc1.align = this.align;
    loc1.blockIndent = this.blockIndent;
    loc1.bold = this.bold;
    loc1.bullet = this.bullet;
    loc1.color = this.color;
    loc1.display = this.display;
    loc1.font = this.font;
    loc1.indent = this.indent;
    loc1.italic = this.italic;
    loc1.kerning = this.kerning;
    loc1.leading = this.leading;
    loc1.leftMargin = this.leftMargin;
    loc1.letterSpacing = this.letterSpacing;
    loc1.rightMargin = this.rightMargin;
    loc1.size = this.size;
    loc1.tabStops = this.tabStops;
    loc1.target = this.target;
    loc1.underline = this.underline;
    loc1.url = this.url;
    return loc1;
  }

  protected /* var */ outSize: int = 12;
}
